package com.xh.bussiness.permission.service;

import com.xh.bussiness.permission.bean.dto.UserDataPermissionBean;
import com.xh.bussiness.permission.bean.dto.UserDataRuleBean;
import com.xh.bussiness.permission.bean.dto.UserDto;
import com.xh.bussiness.permission.bean.request.QueryUserRequest;
import com.xh.bussiness.permission.bean.request.UserRequest;
import com.xh.bussiness.permission.model.User;
import com.xh.bussiness.permission.model.UserRole;
import com.xh.bussiness.permission.model.UserSchool;
import com.xh.bussiness.system.bean.dto.DictionaryBean;
import com.xh.core.bean.XhPage;
import com.xh.core.service.IBaseService;

import java.util.List;
import java.util.Map;

public interface IUserService extends IBaseService<User> {


    /**
     * 查询用户
     * @param bean
     * @return
     */
    public List queryUser(UserRequest bean);


    /**
     * 分页查询用户
     * @param page
     * @param bean
     * @return
     */
    public XhPage queryUserPage(XhPage page, QueryUserRequest bean);

    List<User> queryUserList(QueryUserRequest bean);


    /**
     * 根据用户名查询用户
     * @param username
     * @return
     */
    public User getUserByUsername(String username);


    /**
     * 根据手机号查询用户
     * @param mobile
     * @return
     */
    public User getUserByMobile(String mobile);

    /**
     * 根据手机号获取用户中的非家长
     * 修改getUserByMobile 可能会导致其他问题 所以重写了一个
     **/
    public User getTeacherUserByMobile(String mobile);


    /**
     * 新增用户
     * @param bean
     * @return
     */
    public  String addUser(UserRequest bean);


    /**
     * 修改用户
     * @param bean
     * @return
     */
    public  String modifyUser(UserRequest bean);


    /**
     * 删除用户
     * @param id
     * @return
     */
    public String deleteUser(String id);

    /**
     * 注册
     * @param mobile
     * @param idCard
     * @return
     */
    public Map<String,Object> register(String mobile, String idCard);

    void insertUserRole(User existsUser, String roleId, List<UserRole> savedUserRoles);

    Map<String, Object> reloadUserData(String mobile, String idCard, User existsUser);

    String resetPassword(String userId);

    User queryUserDetailById(String userId);

    List<UserDataPermissionBean> queryUserDataPermission(String userId);

    // 用户数据学科
    List<DictionaryBean> userDataSubjects(String userId);

    // 用户数据权限
    UserDataRuleBean userDataRules(String userId, String subjectCode);

    /**
     * 根据第三方用户id查询
     * @param thirdId 第三方用户id
     * @param source  来源： 1：校管家  2：校宝
     * @return
     */
    User queryUserByThirdId(String thirdId, Integer source);

}
